﻿<form id="frm_edit_role" name="roleEditForm" novalidate>

    <div class="modal-header">
        <button type="button" class="close" ng-click="vm.cancel()" aria-label="Close">
            <span aria-hidden="true">&times;</span>
        </button>
        <h4 class="modal-title">
            <span>@L("EditRole")</span>
        </h4>
    </div>
    <div class="modal-body">
        <div class="row clearfix">
            <div class="col-sm-12">
                <div class="form-group form-float">
                    <div class="form-line">
                        <input class="form-control" type="text" name="RoleName" ng-model="vm.role.name" required maxlength="32" minlength="2">
                        <label class="form-label">@L("RoleName")</label>
                    </div>
                </div>
            </div>
        </div>

        <div class="row clearfix">
            <div class="col-sm-12">
                <div class="form-group form-float">
                    <div class="form-line">
                        <input type="text" name="DisplayName" ng-model="vm.role.displayName" required maxlength="32" minlength="2" class="validate form-control">
                        <label class="form-label">@L("DisplayName")</label>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12">
                <div class="form-group form-float">
                    <div class="form-line">
                        <textarea name="Description" ng-model="vm.role.description" class="validate form-control"></textarea>
                        <label class="form-label">Role Description</label>
                    </div>
                </div>
            </div>
        </div>

        <div class="row clearfix">
            <div class="col-sm-12">
                <h4>Permissions</h4>
                <div class="col-sm-6" ng-repeat="permission in vm.permissions track by $index">
                    <input type="checkbox" name="permission" value="{{permission.name}}" class="filled-in" id="permission-{{$index}}" ng-model="permission.isAssigned" />
                    <label for="permission-{{$index}}">{{permission.displayName}}</label>
                </div>
            </div>
        </div>
    </div>

    <div class="modal-footer">
        <button type="button" class="btn btn-default waves-effect" ng-click="vm.cancel()">
            @L("Cancel")
        </button>
        <button type="submit" class="btn btn-primary waves-effect" ng-click="vm.save()" ng-disabled="roleCreateForm.$invalid">
            @L("Save")
        </button>
    </div>

</form>